package team.seekers.hula.course.resource.examSubmit.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import team.seekers.hula.common.annotation.ApiResponseBody;
import team.seekers.hula.course.resource.exam.entity.dto.ExamQueryDTO;
import team.seekers.hula.course.resource.examSubmit.service.ExamRecordManageService;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * date: 2022/5/9 17:46
 *
 * @author GH
 * QQ 1124813753
 */
@Controller
@ApiResponseBody
@RequestMapping("/manage/exam/record")
public class ExamRecordManageController {

    @Autowired
    private ExamRecordManageService examRecordManageService;

    /**
     * 管理员查询某个用户关于某个课程的所有测试提交
     * @param userId 用户id
     * @param courseId 课程id
     */
    @GetMapping("/list")
    public Map<String,Object> list(@RequestParam String courseId,
                    @RequestParam String userId) {
//        List<List<ExamQueryDTO>> chapterExamRecords = examRecordManageService.listChapterExamByCourseId(courseId, userId);
        List<ExamQueryDTO> finalExamRecords = examRecordManageService.listFinalExamByCourseId(courseId, userId);

        HashMap<String, Object> result = new HashMap<>();
//        result.put("chapterExamRecords",chapterExamRecords);
        result.put("finalExamRecords",finalExamRecords);
        return result;
    }
}
